#!/usr/bin/php
<?php
define('MAXNODES',20);
if(count($argv) != 2) {
	echo "usage: php " . $argv[0] . " <NODE_COUNT>\nWhere <NODE_COUNT> is the number of nodes in your cluster\n";
	exit(1);
}

$nodecount = $argv[1];
if(!is_numeric($nodecount) || $nodecount <=0 || $nodecount > MAXNODES) {
	echo "ERROR: You must specify an integer number of nodes, greater than zero and less than or equal to " . MAXNODES . "\n";
	echo "usage: php " . $argv[0] . " <NODE_COUNT>\nWhere <NODE_COUNT> is the NUMBER (an integer) of nodes in your cluster\n";
	exit(1);
}

echo <<<EOF
[default]
user=shardquery
password=mpp
port=3306
column=date_id
mapper=hash
gearman=shard1:7000
coord_shard=ontime1
between=*
inlist=*


EOF;

for($i=0;$i<MAXNODES;++$i) {
	$shard = ($i % $nodecount)+1;
	$db = $i+1;
	echo "[ontime$db]\nhost=shard$shard\n\n";
}










